<%--
  @author Mahesha Kalpanie
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<script src="${pageContext.request.contextPath}/js/documentUpload.js" type="text/javascript"></script>
<script type="text/javascript">
    var docCategoryAlienation = new Object();
    var rowCountAlienation = 0;

    $(function () {
        $('#documentUploadAlienation').hide();
    });
</script>

<s:if test="documentCategoriesAlienation != null">
    <s:iterator value="documentCategoriesAlienation" status="stat">
        <script type="text/javascript">
            <s:if test="id!=1">
            docCategoryAlienation['<s:property value="id"/>'] = '<s:property value="categoryName"/>';
            </s:if>
        </script>
    </s:iterator>
</s:if>
<table>
    <tr>
        <td colspan="4">
            <input value="Attach Documents" type="button"
                   onclick="addFile('documentUploadAlienation', docCategoryAlienation, rowCountAlienation);"/>
        </td>
    </tr>
    <tr>
        <td colspan="4">
            <table id="documentUploadAlienation">
            </table>
        </td>
    </tr>

    <s:if test="documentList != null">
        <tr>
            <td colspan="4">
                <table class="document-list">
                    <s:iterator value="documentList">
                        <tr>
                            <td class="document-icon">
                                <img src="${pageContext.request.contextPath}/images/detailed-form.png"/>
                            </td>
                            <td class="document-type">
                                <s:if test="documentCategory!=null">
                                    <s:property value="documentCategory.categoryName"/>
                                </s:if>

                            </td>
                            <td class="document-name">
                                <s:if test="documentCategory!=null">
                                    <s:property value="documentName"/>
                                </s:if>
                                <s:else>
                                    <s:property value="documentName"/>
                                </s:else>
                            </td>
                            <td class="document-download">
                                <s:url action="downloadFile" id="download">
                                    <s:param name="documentId"><s:property value="id"/></s:param>
                                </s:url>
                                <s:a href="%{download}" title="%{getText('download.label')}"><s:label
                                        value="%{getText('download.label')}"/><img
                                        src="${pageContext.request.contextPath}/images/download.png"></s:a>
                            </td>
                        </tr>
                    </s:iterator>
                </table>
            </td>
        </tr>
    </s:if>
    <br>
</table>
